package com.longshine.tools.util;
/**
 * 字符串工具类
 * @author Administrator
 *
 */
public class StrTmpUtil {
	/**
	 * XXX_XXX转xxxXxx
	 * @param dbStr
	 * @return
	 */
	public static String dB2JavaString(String dbStr){
		dbStr = dbStr.toLowerCase();
		String ss[] = dbStr.split("_");
		String ret = ss[0];
		for(int i = 1;i<ss.length;i++){
			ret += firstWordUpper(ss[i]);
		}
		return ret;
	}
	/**
	 * 转第一个字母大写
	 * @param str
	 * @return
	 */
	private static String firstWordUpper(String str){
		String head = str.substring(0,1);
		String tail = str.substring(1);
		return head.toUpperCase()+tail;
	}
	/**
	 * 
	 * @param str
	 * @return
	 */
	public static String tcpStrExchangeSeqence(String str){
		String ret = "";
		int l = str.length()/2;
		int i = 0;
		while(i<l){
			ret += str.substring(2*(l-i-1),2*(l-i-1)+2);
			i++;
		}
		return ret;
	}
	
	public static String[] splitLength(String str,int len){
		String ret[] = new String[str.length()/len];
		int start = 0;
		int end = len;
		int i = 0;
		while(i<ret.length){
			ret[i] = str.substring(start+i*len,end+i*len);
			i++;
		}
		return ret;
	}
	public static void main(String[] args){
		System.out.println(dB2JavaString("ddd"));
	}
}
